package com.jgp.sys.model;

import com.jgp.common.persistence.TreeModel;
import com.jgp.common.pojo.TreeBean;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

/**
 * 项目   sys
 * 作者   loufei
 * 时间   2018/2/28
 */
@Entity
@Table(name = "sys_menu")
public class Menu extends TreeModel {
    
    private static final long serialVersionUID = -6602156227165612596L;
    //标题/菜单名
    @NotBlank
    @Column(name = "title", length = 50)
    private String title;
    //排序
    @Column(name = "sort", length = 3)
    private Integer sort;
    //编码
    @Column(name = "code", length = 50)
    private String code;
    //图标
    @Column(name = "icon", length = 30)
    private String icon;
    //是否可用
    @Type(type = "yes_no")
    @Column(name = "enabled")
    private Boolean enabled;
    //链接
    @Column(name = "link", length = 200)
    private String link;
    
    //说明
    @Column(name = "remark")
    private String remark;
    
    @Column(name = "type")
    private String type;
    
    @Column(name = "weight")
    private Integer weight;
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public Integer getSort() {
        return sort;
    }
    
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    
    public String getCode() {
        return code;
    }
    
    public void setCode(String code) {
        this.code = code;
    }
    
    public String getIcon() {
        return icon;
    }
    
    public void setIcon(String icon) {
        this.icon = icon;
    }
    
    public Boolean getEnabled() {
        return enabled;
    }
    
    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
    
    public String getLink() {
        return link;
    }
    
    public void setLink(String link) {
        this.link = link;
    }
    
    public String getRemark() {
        return remark;
    }
    
    public void setRemark(String remark) {
        this.remark = remark;
    }
    
    public String getType() {
        return type;
    }
    
    public void setType(String type) {
        this.type = type;
    }
    
    public Integer getWeight() {
        return weight;
    }
    
    public void setWeight(Integer weight) {
        this.weight = weight;
    }
    
    @Override
    public TreeBean mapping() {
        TreeBean bean = super.mapping();
        bean.setTitle(getTitle());
        bean.setIcon(getIcon());
        return bean;
    }
}
